#ifndef MANUALCONTROL_H
#define MANUALCONTROL_H

#include <QMainWindow>
#include<QDebug>
#include<QTimer>
namespace Ui {
class ManualControl;
}

class ManualControl : public QMainWindow
{
    Q_OBJECT

public:
    explicit ManualControl(QWidget *parent = nullptr);
    ~ManualControl();
   static ManualControl* instance();
signals:
void sendRaiseAirTemperature(int step=1);
void sendCloseHeatingEquipment(int index=0);
void sendReduceAirTemperature(int step=-1);
void sendCloseReduceEquipment(int index=0);

void sendOpenIrrigationEquipment(int step=1 );
void sendCloseIrrigationEquipment(int index=1);
void sendOpenVentilatingEquipmentG2_1(int step=-1);
void sendCloseVentilatingEquipmentG2_1(int index=1);

void sendOpenVentilatingEquipmentG2_2(int step=-80);//降低CO2浓度
void sendCloseVentilatingEquipmentG2_2(int index=3);
void sendOpenCO2InterpolatorEquipment_G3(int step=50);//增加CO2浓度
void sendCloseCO2InterpolatorEquipment_G3(int index=3);


void sendOpenLightingEquipment_G5(int step=2);//增加光照强度
void sendCloseLightingEquipment_G5(int index=2);
void sendOpenRollUpDoorEquipment_G4(int step=-1);//降低光照强度
void sendCloseRollUpDoorEquipment_G4(int index=2);

void sendOpenIrrigationEquipmentG1_2(int step=1);
void sendCloseIrrigationEquipmentG1_2(int index=4);
void sendOpenVentilatingEquipmentG2_3(int step=-1);//降低土壤湿度
void sendCloseVentilatingEquipmentG2_3(int index=4);
private:
    Ui::ManualControl *ui;
    int i=0;
    QTimer *timerG1_1;
    QTimer *timerG1_2;
    QTimer *timerG2_1;
    QTimer *timerG2_2;
    QTimer *timerG2_3;
    QTimer *timerG3;
    QTimer *timerG4;
    QTimer *timerG5;
    QTimer *timerG6;
    QTimer *timerG7;
private:
    void initManualControl();
private slots:
    void controlheatingEquipment(bool status);
    void openHeatingEquipment();
    void controlairCoolerEquipment(bool status);
    void openairCoolerEquipment();

    void controlIrrigationEquipment(bool status);
    void openIrrigationEquipment();
    void controlVentilatingEquipmentG2_1(bool status);
    void openVentilatingEquipmentG2_1();

    void controlVentilatingEquipmentG2_2(bool status);
    void openVentilatingEquipmentG2_2();
    void controlCO2InterpolatorEquipment_G3(bool status);
    void openCO2InterpolatorEquipment_G3();


    void controlLightingEquipment_G5(bool status);
    void openLightingEquipment_G5();
    void controlRollUpDoorEquipment_G4(bool status);
    void openRollUpDoorEquipment_G4();


    void controlIrrigationEquipmentG1_2(bool status);//灌溉土壤
    void openIrrigationEquipmentG1_2();
    void controlVentilatingEquipmentG2_3(bool status);
    void openVentilatingEquipmentG2_3();

};

#endif // MANUALCONTROL_H
